﻿using AutoMapper;
using HamcoWcs.Contract.ContractCommon;
using HamcoWcs.DAL;
using Quartz;
using System.Threading.Tasks;

namespace HamcoWcs.Workers.LoggerWorkers
{
    /// <summary>
    /// 日志后台服务<br/>
    /// 备份|删除
    /// </summary>
    [DisallowConcurrentExecution]
    public class LoggerWorker : WorkerBase
    {
        private readonly ILoggerService _log;
        public LoggerWorker(WcsDbContext wcsDbContext, IMapper mapper, ILoggerService logger) : base(wcsDbContext, mapper, logger)
        {
            _log = logger;
        }

        public override Task Execute(IJobExecutionContext context)
        {
            var task = context.MergedJobDataMap.GetString("eqptSymbol");
            DoWork(task);
            return Task.CompletedTask;
        }

        private void DoWork(string task)
        {
            DoDelete();

        }

        private void DoDelete() => _log.DeleteLog();


        private void DoBackup()
        {
            // 无备分操作
        }


    }
}
